//
//  HWVipCenterTopView.swift
//  HWanGame
//
//  Created by 王昌健 on 2021/12/9.
//  Copyright © 2021 94Wan. All rights reserved.
//

import UIKit

class HWVipCenterTopView: UIView {
    var topBgView:UIView!
    var topImageView:UIImageView!
    override init(frame: CGRect) {
        super.init(frame: frame)
        initUI()
        initFrame()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        UIColor.gradientColor(view: topBgView, colors: [UIColor.colorWithHexString(hexString: "#646468").cgColor,
                                                        UIColor.colorWithHexString(hexString: "#33333F").cgColor,],start: CGPoint(x: 0, y: 0),end: CGPoint(x: 1, y: 1))
        
//        bottomBgView.addCorner(conrners: [.topLeft,.topRight], radius: 29)
//
        UIColor.gradientColor(view: topImageView, colors: [UIColor.colorWithHexString(hexString: "#262626").cgColor,
                                                         UIColor.colorWithHexString(hexString: "#232323").cgColor,],start: CGPoint(x: 0, y: 0),end: CGPoint(x: 1, y: 1))
    }

}

extension HWVipCenterTopView {
    private func initUI() -> Void {
        topBgView = UIView()
        addSubview(topBgView)
        sendSubviewToBack(topBgView)
        topImageView = UIImageView()
        
        addSubview(topImageView)
    }
    
    private func initFrame() -> Void {
        topBgView.snp.makeConstraints { make in
            make.left.top.right.equalToSuperview()
            make.height.equalTo(screenHeight/2)
        }
        
        topImageView.snp.makeConstraints { make in
            make.left.equalTo(10)
            make.right.equalTo(-10)
//            make.top.equalTo(navigationView.snp.bottom).offset(25)
            make.height.equalTo(topImageView.snp.width).multipliedBy(0.44)
        }
    }
}
